package de.koller.so.gl;

import de.koller.oceanFramework.gl.util.ViewUtil;
import de.koller.so.model.Polygon;
import org.lwjgl.opengl.GL11;

public class SORendererGL extends SSeaGL {
	
	@Override
	protected void init() {
		super.init();

		ViewUtil.initPerspective();
		
//		GL11.glEnable( GL11.GL_CULL_FACE );
//		GL11.glCullFace( GL11.GL_BACK );

		GL11.glEnable( GL11.GL_DEPTH_TEST );
		GL11.glDepthFunc( GL11.GL_LEQUAL );
		
		GL11.glAlphaFunc( GL11.GL_GREATER, 0.1f );
		GL11.glEnable( GL11.GL_ALPHA_TEST );
	}

	public void renderFast() {
		GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT | GL11.GL_STENCIL_BUFFER_BIT);
		
		sroot.flycamera.preTransform(); 
		
		for( Polygon p : sroot.polygons )
			p.renderFast();
		
		sroot.flycamera.postTransform();
	}
	
}
